<template>
  <div class="check-con" id="checkCon">
    <div class="right-content">
      <div class="check-info">
        <div class="split-st">
          <Tab000 :orgName='orgName' :orgId="props.currentRow.creditCode" :examineYear="props.currentRow.examineYear"/>
        </div>
        <div class="split-st">
          <Tab011 />
        </div>
        <div class="split-st">
          <Tab021 />
        </div>
        <div class="split-st">
          <Tab031 />
        </div>
        <div class="split-st">
          <Tab041 />
        </div>
        <div class="split-st">
          <Tab051 />
        </div>
        <div class="split-st">
          <Tab061 />
        </div>
        <div class="split-st">
          <Tab071 />
        </div>
        <div class="split-st">
          <Tab081 />
        </div>
        <div class="split-st">
          <Tab091 />
        </div>
        <div class="split-st">
          <Tab0101 />
        </div>
        <div class="split-st">
          <Tab0111 />
        </div>
        <div class="split-st">
          <Tab0121 />
        </div>
        <div class="split-st">
          <Tab0131 />
        </div>
        <div class="split-st">
          <Tab0141 />
        </div>
        <div class="split-st">
          <Tab0151 />
        </div>
        <div class="split-st">
          <Tab0161 />
        </div>
        <div class="split-st">
          <Tab0171 />
        </div>
        <div class="split-st">
          <Tab0181 />
        </div>
        <div class="split-st">
          <Tab0191 />
        </div>
        <div class="split-st">
          <Tab0201 />
        </div>
        <div class="split-st">
          <Tab0211 />
        </div>
        <div class="split-st">
          <Tab0221 />
        </div>
        <div class="split-st">
          <Tab0231 />
        </div>
        <div class="split-st">
          <Tab0241 />
        </div>
        <div class="split-st">
          <Tab0251 />
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import jsPDF from 'jspdf';
import html2canvas from 'html2canvas';
import PDFLoader from './pdf.js';

import APTMethods from '@/api/yearCheck/mfOrg'
import { ref, reactive, nextTick, provide } from 'vue'
import Tab000 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab000.vue' //封面
import Tab011 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab011.vue' //基础信息
import Tab021 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab021.vue' //从业人员情况信息
//内部建设
import Tab031 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab031.vue' //负责人信息
import Tab041 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab041.vue' //理事会成员、监视情况信息
import Tab051 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab051.vue' //办事机构情况
import Tab061 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab061.vue' //内部建设情况
import Tab071 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab071.vue' //接受监督检查情况
import Tab081 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab081.vue' //开展公益活动情况
import Tab091 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab091.vue' //承接政府委托职能、购买服务项目、政府补贴情况
import Tab0101 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0101.vue' //国际合作情况
import Tab0111 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0111.vue' //对外交流、国际组织
import Tab0121 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0121.vue' //对外活动建议
import Tab0131 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0131.vue' //举办刊物及公益活动
import Tab0141 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0141.vue' //援藏援疆及乡村振兴活动,
import Tab0151 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0151.vue' //参与成渝经济圈建设情况
import Tab0161 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0161.vue' //年度工作报告
import Tab0171 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0171.vue' //年检审核意见

import Tab0181 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0181.vue' //现金流量表
import Tab0191 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0191.vue' //接受捐赠资助及使用
import Tab0201 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0201.vue' //
import Tab0211 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0211.vue' //参与成渝经济圈建设情况
import Tab0221 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0221.vue' //公益慈善活动支出
import Tab0231 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0231.vue' //党建情况
import Tab0241 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0241.vue' //上年度整改情况表
import Tab0251 from '@/views/yearCheck/checkResult/components/checkMF/checkItem/tab0251.vue' //附件材料

import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'
const props = defineProps({
  currentRow: {
    type: Object,
    default: {}
  }
})


defineOptions({
  name: 'logManagement'
})

const emit = defineEmits(['openResult', 'openOpinion'])
const orgName = ref('')

orgName.value = props.currentRow.organizationBaseName


const getDetailInfo = (index) => {
  const { creditCode, organizationType, id } = props.currentRow
  return new Promise((resolve, reject) => {
    APTMethods.getMFInfoByPage({
      id,
      organizationType,
      pageNumberMark: index - 0  //页码
    }).then((res) => {
      resolve(res.data)
    })
  })
}

// 提供方法给子组件
provide('getDetailInfo', { getDetailInfo });

const handleDownload = () => {
  const loading = ElLoading.service({
    lock: true,
    text: '下载中...',
    background: 'rgba(0, 0, 0, 0.2)'
  })

  let element = document.getElementById('checkCon');
  let pdf = PDFLoader.downloadPDF(element, 'pdf', 'split-st');
  setTimeout(() => {

  }, 2000)
  return pdf.outPutPdfFn('jjjjjj');
};


// // 调用函数以生成PDF
setTimeout(() => {
  handleDownload();
}, 3000)

</script>
<style lang="scss" scoped>
.right-content {
  width: 100%;
}

::v-deep .el-dialog {
  margin-bottom: 0;
}

::v-deep .el-dialog__body {
  padding-top: 0 !important;
}

table.m-table {
  border-spacing: 0px;
  width: 100%;
  border-top: 1px solid #999;
  border-left: 1px solid #999;
  color: #000;

  thead {
    background: #f0f7fc;
    color: rgb(37, 43, 53);

    th {
      border-right: 1px solid #999;
      border-bottom: 1px solid #999;
      text-align: center;
      height: 32px;
    }
  }


  td {
    height: 32px;
    border-right: 1px solid #999;
    border-bottom: 1px solid #999;
    text-align: center;

    &.td-head {
      background: #f0f7fc;
    }
  }
}
</style>
<style lang="scss" scoped>
//隐藏滚轮
::v-deep .el-switch.is-disabled {
  opacity: 1;
}

::v-deep .el-descriptions__title {
  margin-top: 15px;
}

.check-con {
  width: 1200px;
  // height: 500px;
  // padding: 0 50px;
  overflow: auto;
  box-sizing: border-box;
  display: flex;

  ::-webkit-scrollbar {
    width: 0;
  }

  //将宽度设为0，滚动条就会隐藏。
  ::-webkit-scrollbar {
    display: none;
  }


  .check-info {
    flex: 1;
    padding-right: 20px;
    color: #000;
    padding: 0 80px;

    >div.split-st {
      transition: all 0.5s ease-in-out;
      // margin-bottom: 200px;
      // max-height: 1200px;
      // min-height: 700px;
      min-height: 1000px;
    }
  }
}

.msg-tip {
  padding: 20px 0;
  color: #000;
  font-family: '微软雅黑';
}
</style>
